package com.example.fp.cgc.entity

import com.baomidou.mybatisplus.annotation.IdType
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import org.springframework.format.annotation.DateTimeFormat
import java.util.*

/**
 * @since 2020-02-14
 * @author 蔡
 * 用户之间传递消息
 * @property fromId 发送方id
 * @property fromName 发送方名字
 * @property toId 接收方名字
 * @property messageText 消息内容
 * @property isRead 是否读取
 * @property messageDate 消息发送时间
 */
@TableName("message")
class Message {
    @TableId(value = "id", type = IdType.AUTO)
    var mId: Int = 0

    @TableField("fromId")
    var fromId: Int = 0

    @TableField("fromName")
    var fromName: String = ""

    @TableField("toId")
    var toId: Int = 0

    @TableField("messageText")
    var messageText: String = ""

    @TableField("isRead")
    var isRead: Boolean = false

    @TableField("messageDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var messageDate: Date? = null
}